<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:DentalGUIHelper;assembly=DentalConfig"
  xmlns:dentalConverters="clr-namespace:DentalConfig.Converters;assembly=DentalConfig">

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="../Brushes/MaterialDesign/MaterialDesignTheme.Theme.xaml"/>
  </ResourceDictionary.MergedDictionaries>
  <!-- ========================= -->
  <!-- Converters -->
  <!-- ========================= -->
  <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
  <dentalConverters:BrushToTransmittantBrushConverter x:Key="BrushToTransmittantBrushConverter"/>

  <Style x:Key="WizardContentAndTextRadioButtonStyle" TargetType="{x:Type local:ContentAndTextRadioButton}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}"/>
    <Setter Property="BorderThickness" Value="2"/>
    <Setter Property="Width" Value="Auto"/>
    <Setter Property="Height" Value="Auto"/>
    <Setter Property="HorizontalAlignment" Value="Stretch"/>
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="TextDock" Value="Right"/>
    <Setter Property="TextMargin" Value="5"/>
    <Setter Property="FontSize" Value="{DynamicResource ButtonFontSize}"/>
    <Setter Property="ContentWidth" Value="Auto"/>
    <Setter Property="ContentHeight" Value="Auto"/>
    <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
    <Setter Property="Margin" Value="-30, 0"/>
    <Setter Property="Padding" Value="30, 0"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type local:ContentAndTextRadioButton}">
          <Grid Background="{TemplateBinding Background}">
            <Grid x:Name="checkedBackground" Background="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter=0.12}" Visibility="Collapsed"/>
            <DockPanel Margin="{TemplateBinding Padding}" Name="contentContainer" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
              <Grid x:Name="grid" Margin="3" DockPanel.Dock="Left">
                <Viewbox Width="{TemplateBinding ContentWidth}" Height="{TemplateBinding ContentHeight}" Margin="4,3">

                  <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </Viewbox>
              </Grid>
              <!-- Text -->
              <TextBlock
                x:Name="PART_TextBlock"
                Text="{TemplateBinding Text}"
                Foreground="{TemplateBinding Foreground}"
                Margin="{TemplateBinding TextMargin}"
                TextWrapping="WrapWithOverflow"
                Visibility="{TemplateBinding ShowText, Converter={StaticResource BooleanToVisibilityConverter}}"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"/>
            </DockPanel>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="TextDock" Value="Right">
              <Setter TargetName="grid" Property="DockPanel.Dock" Value="Left"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Left">
              <Setter TargetName="grid" Property="DockPanel.Dock" Value="Right"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Top">
              <Setter TargetName="grid" Property="DockPanel.Dock" Value="Bottom"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Bottom">
              <Setter TargetName="grid" Property="DockPanel.Dock" Value="Top"/>
            </Trigger>
            <Trigger Property="ToggleButton.IsChecked" Value="True">
              <Setter Property="Visibility" TargetName="checkedBackground" Value="Visible"/>
              <Setter Property="Foreground" Value="{DynamicResource SecondaryAccentBrush}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" Value="{Binding Foreground, RelativeSource={RelativeSource Self}, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter=0.12}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="RenderTransform">
                <Setter.Value>
                  <TransformGroup>
                    <!--<ScaleTransform ScaleX="0.95" ScaleY="0.95" />-->
                    <TranslateTransform X="1" Y="1"/>
                  </TransformGroup>
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" Value="{StaticResource DisabledOpacity}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="WizardMaskedContentAndTextRadioButtonStyle" BasedOn="{StaticResource WizardContentAndTextRadioButtonStyle}" TargetType="{x:Type local:ContentAndTextRadioButton}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type local:ContentAndTextRadioButton}">
          <Grid Background="{TemplateBinding Background}">
            <Grid x:Name="checkedBackground" Background="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter=0.12}" Visibility="Collapsed"/>
            <DockPanel Margin="{TemplateBinding Padding}" Name="contentContainer" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
              <Grid x:Name="grid" Margin="3" DockPanel.Dock="Left">
                <Rectangle Fill="{TemplateBinding Foreground}" Width="{Binding ElementName=contentPresenter, Path=ActualWidth}" Height="{Binding ElementName=contentPresenter, Path=ActualHeight}" Margin="4,3">
                  <Rectangle.OpacityMask>
                    <VisualBrush TileMode="None" Stretch="None">
                      <VisualBrush.Visual>
                        <Viewbox Width="{TemplateBinding ContentWidth}" Height="{TemplateBinding ContentHeight}">
                          <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Viewbox>
                      </VisualBrush.Visual>
                    </VisualBrush>
                  </Rectangle.OpacityMask>
                </Rectangle>
              </Grid>
              <!-- Text -->
              <TextBlock
                x:Name="PART_TextBlock"
                Text="{TemplateBinding Text}"
                Foreground="{TemplateBinding Foreground}"
                Margin="{TemplateBinding TextMargin}"
                TextWrapping="WrapWithOverflow"
                Visibility="{TemplateBinding ShowText, Converter={StaticResource BooleanToVisibilityConverter}}"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"/>
            </DockPanel>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="TextDock" Value="Right">
              <Setter TargetName="grid" Property="DockPanel.Dock" Value="Left"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Left">
              <Setter TargetName="grid" Property="DockPanel.Dock" Value="Right"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Top">
              <Setter TargetName="grid" Property="DockPanel.Dock" Value="Bottom"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Bottom">
              <Setter TargetName="grid" Property="DockPanel.Dock" Value="Top"/>
            </Trigger>
            <Trigger Property="ToggleButton.IsChecked" Value="True">
              <Setter Property="Visibility" TargetName="checkedBackground" Value="Visible"/>
              <Setter Property="Foreground" Value="{DynamicResource SecondaryAccentBrush}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" Value="{Binding Foreground, RelativeSource={RelativeSource Self}, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter=0.12}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="RenderTransform">
                <Setter.Value>
                  <TransformGroup>
                    <!--<ScaleTransform ScaleX="0.95" ScaleY="0.95" />-->
                    <TranslateTransform X="1" Y="1"/>
                  </TransformGroup>
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" Value="{StaticResource DisabledOpacity}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>
